﻿Imports Twitterizer

Public Class TweetSender

    Public Shared Sub SendTweet(ByVal message As String)
        Dim response = TwitterStatus.Update(TwitterAuth.GetOAuthTokens(), message)
        If Not String.IsNullOrEmpty(response.ErrorMessage) Then
            'error occurred posting tweet, report to user
            MessageBox.Show(String.Format("Sending tweet failed:  {0}", response.ErrorMessage))
            DebugHelper.MessageToFile(String.Format("Sending tweet failed:  {0}", response.ErrorMessage))
        End If
    End Sub

    Public Shared Sub SendScreenshot()
        DebugHelper.MessageToFile("Sending screenshot.")
        Dim screenshot = PCHandler.GetScreenshot()
        If screenshot IsNot Nothing AndAlso screenshot.Length > 0 Then
            Dim response = TwitterStatus.UpdateWithMedia(TwitterAuth.GetOAuthTokens(), "Screenshot", screenshot)
            If Not String.IsNullOrEmpty(response.ErrorMessage) Then
                Dim message = String.Format("Sending screenshot failed:  {0}", response.ErrorMessage)
                MessageBox.Show(message)
                DebugHelper.MessageToFile(message)
            End If
        End If
    End Sub

End Class
